home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48hor1 / bodeplot.src < prev    next >
Text File  |  1991-02-21  |  931b  |  27 lines

  1. %%HP: T(3)A(D)F(.);
  2. @ BODEPLOT
  3. @ by James B. Walters
  4. DIR
  5.   BODE            @ Main program.
  6.     \<< ERASE DB STEQ    @ This routine plots the gain and phase
  7. 0 4 XRNG -60 20        @ of the transfer function G.
  8. YRNG DRAX DRAW        @ Plots 4 decades  from Wo, gain from -60 dB 
  9. PHASE STEQ -270 90    @ to 20 dB, and phase from -270 to 90 degrees.
  10. YRNG DRAW        @ Plot range can be modifed by changing program.
  11.     \>>
  12.   PHASE 'ARG(G)'        @ Phase of G defined as ARG(G)
  13.   Wo .1            @ Wo is start frequency of bode plot
  14.   X 4.1
  15.   EQ 'ARG(G)'
  16.   PPAR { (0,-270)
  17. (4,90) X 0 (0,0)
  18. FUNCTION Y }
  19.   D 'S^2+1*S+100'        @ D is denominator of transfer function
  20.   N 100            @ N is numerator of transfer function
  21.   G 'N/D'            @ G is the transfer function
  22.   DB '20*LOG(ABS(G)    @ DB is the gain of G
  23. )'
  24.   S 'i*W'            @ S is defined as W*sqr(-1)
  25.   W 'Wo*10^X'        @ Map plot axis to frequency for log scale
  26. END
  27.